<?php
use App\Models\Category;
use Illuminate\Support\Facades\Auth;

return [
    'title' => '分类',
    'single' => '分类',
    'model' => Category::class,

    'action_permissions' => [
        'delete' => function ($model) {
            return Auth::user()->hasRole('Founder');
        },


    ],
    'columns' => [
        'id' => [
            'title' => 'ID'
        ],
        'name' => [
            'title' => '名称',
            'sortable' => false,
        ],
        'description' => [
            'title' => '描述',
            'sortable' => false,
        ],
        'operation' => [
            'title' => '管理',
            'sortable' => false,
        ]
    ],
    'edit_fields' => [
        'name' => [
            'title' => '名称',
        ],
        'description' => [
            'title' => '描述',
            'type'=>'textarea'
        ],

    ],
    'filters' => [
        'id' => [
            'title' => 'ID'
        ],
        'name' => [
            'title' => '名称'
        ],
        'description' => [
            'title' => '描述'
        ],
    ],
    'rules'=>[
        'name'=>'required|between:2,30|unique:categories'
    ],
    'messages'=>[
        'name.required'=>'分类名称不能为空',
        'name.between'=>'分类名称在2-30之间',
        'name.unique'=>'分类名称不能重复',
    ],

];
